package cn.tedu.weibo.result;

import lombok.*;

//@Data
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class JsonResult {
    private Integer statusCode;//状态码
    private String message;//响应的提示信息
    private Object data;//给前端回复的数据内容

    public JsonResult(Status status) {
        this.statusCode = status.getStatusCode();
        this.message = status.getMessage();
    }
    public JsonResult(Status status,Object data){
        this(status);
        this.data = data;
    }
    public static JsonResult success(){
//        return new JsonResult(Status.OPERATION_SUCCESS);
//        return new JsonResult(Status.OPERATION_SUCCESS,null);
        return JsonResult.success(null);
    }
    public static JsonResult success(Object data){
        return new JsonResult(Status.OPERATION_SUCCESS,data);
    }
}
